# coding: utf-8

s = 'abcdefg'
print(s)
print('s.lower', s.lower())
print('s.upper', s.upper())
print('s.split', s.split(sep='d'))
print('s.count', s.count('d'))
print('s.find', s.find('d'))
print('s.index', s.index('d'))
print('s.startswith', s.startswith('g'))
print('s.endswith', s.endswith('g'))
print('s.replace', s.replace('d', 'D'))

print('s.center 在指定宽度范围内居中，可指定填充字符')
print(s.center(50, '-'))
print('s.join', s.join('-'))

print('s.strip 去掉两侧指定的字符，默认为空格', s.strip('g'))
print('s.lstrip 去掉左侧空格', s.lstrip('a'))
print('s.rstrip 去掉右侧空格', s.rstrip('g'))

n = 425
f = 3.1415926
print('%s----%d-----%.2f' % (s, n, f))
print(f'{s}----{n}-----{f:.2f}')
print('{0}----{1}-----{2}'.format(s, n, f))

print('{0:*<20}'.format(s))
print('{0:*>20}'.format(s))
print('{0:*^20}'.format(s))

print(s.center(20, '*'))

print('{0:,}'.format(n))
print('{0:,}'.format(f))
print('{0:.2f}'.format(f))
print('{0:.5}'.format(s))

print('二进制:{0:b},八进制:{0:o},十进制:{0:d},十六进制:{0:x},十六进制:{0:X}'.format(n))

print('{0:.2f},{0:.2E},{0:.2e},{0:.2%}'.format(f))